package org.six11.util.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * 
 * 
 * @author Gabe Johnson <johnsogg@cmu.edu>
 */
public abstract class StreamUtil {

  public static String inputStreamToString(InputStream in) {
    StringBuilder out = new StringBuilder();
    try {
      byte[] b = new byte[4096];
      for (int n; (n = in.read(b)) != -1;) {
        out.append(new String(b, 0, n));
      }
    } catch (IOException ex) {
      out.append("exception: " + ex.getMessage());
    }
    return out.toString();
  }
}
